import { baseUrlApi, requestClient, type Result } from '#/api/request';

/** 部门列表 */
export const getDeptList = (params?: object) => {
  return requestClient.get<Result>(
    baseUrlApi('/plugin/dept/api_admin_index/index'),
    {
      params,
    },
  );
};

/** 新增部门 */
export const postDept = (data: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/plugin/dept/api_admin_index/save'),
    data,
  );
};

/** 更新部门 */
export const putDept = (data: object) => {
  return requestClient.put<Result>(
    baseUrlApi('/plugin/dept/api_admin_index/update'),
    data,
  );
};

/** 删除部门 */
export const deleteDept = (data: object) => {
  return requestClient.delete<Result>(
    baseUrlApi('/plugin/dept/api_admin_index/delete'),
    data,
  );
};

/** 部门人员列表 */
export const getDeptUserList = (params?: object) => {
  return requestClient.get<Result>(
    baseUrlApi('/plugin/dept/api_admin_user/index'),
    {
      params,
    },
  );
};

/** 新增部门人员 */
export const postUserDept = (data: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/plugin/dept/api_admin_user/save'),
    data,
  );
};

/** 更新部门人员 */
export const putUserDept = (data: object) => {
  return requestClient.put<Result>(
    baseUrlApi('/plugin/dept/api_admin_user/update'),
    data,
  );
};

/** 删除部门人员 */
export const deleteUserDept = (data: object) => {
  return requestClient.delete<Result>(
    baseUrlApi('/plugin/dept/api_admin_user/delete'),
    data,
  );
};
